<%
=begin
apps: kafka
platforms: kubernetes, tanzu-application-catalog
id: external_access
title: Access Kafka brokers from outside the cluster
category: administration
weight: 70
=end %>

In order to access Kafka Brokers from outside the cluster, an additional listener and advertised listener must be configured. Additionally, a specific service per kafka pod will be created.

There are two ways of configuring external access. Using LoadBalancer services or using NodePort services.

### Using LoadBalancer services

~~~
externalAccess.enabled=true
externalAccess.service.type=LoadBalancer
externalAccess.service.port=19092
externalAccess.service.loadBalancerIP={'external-ip-1', 'external-ip-2'}
~~~

You need to know in advance the load balancer IPs so each Kafka broker advertised listener is configured with it.

~~~
Using NodePort services
externalAccess.enabled=true
externalAccess.service.type=NodePort
externalAccess.service.nodePorts=['node-port-1', 'node-port-2']
~~~

You need to know in advance the NodePort that will be exposed for each Kafka broker. It will be used to configure the advertised listener of each broker. Valid node ports are typically in the range 30000-32767

The pod will try to get the external IP of the node using *curl -s https://ipinfo.io/ip* unless externalAccess.service.domain is provided.
